﻿<Page
    x:Name="pageRoot"
    x:Class="BootyBay.PrivateStoreApp.DownloadAppsPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:BootyBay.PrivateStoreApp"
    xmlns:common="using:BootyBay.PrivateStoreApp.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    >
    <Page.TopAppBar>
        <AppBar BorderThickness="1" BorderBrush="#99205B96" Margin="0,-2,0,0">
            <Grid Height="105" Background="#99205B96">
                <StackPanel Orientation="Horizontal">
                    <Button Margin="27,0,0,0" Content="主页" Background="#77ACE1" BorderThickness="0" Style="{StaticResource AppsPage_Home_ButtonStyle}" x:Name="btn_Home" Click="btn_Home_Click"></Button>
                    <Button Margin="10,0,0,0" Content="你的应用" Background="#77ACE1" BorderThickness="0" Style="{StaticResource AppsPage_YourApps_ButtonStyle}" x:Name="btn_AppList" Click="btn_AppList_Click"></Button>
                </StackPanel>
            </Grid>
        </AppBar>
    </Page.TopAppBar>
    <Page.Resources>
        <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
        <x:String x:Key="AppName">安装</x:String>
        <common:IsShowDefaultPicConverter x:Key="IsShowDefaultPicConverter"></common:IsShowDefaultPicConverter>
    </Page.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid>
        <Grid.Background>
            <ImageBrush ImageSource="Images/bg.png"></ImageBrush>
        </Grid.Background>
        <Grid.ChildrenTransitions>
            <TransitionCollection>
                <EntranceThemeTransition/>
            </TransitionCollection>
        </Grid.ChildrenTransitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Margin="39,45,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
                        Style="{StaticResource NavigationBackButtonNormalStyle}"
                        VerticalAlignment="Top"
                        AutomationProperties.Name="Back"
                        AutomationProperties.AutomationId="BackButton"
                        AutomationProperties.ItemType="Navigation Button"/>
            <TextBlock x:Name="pageTitle" Text="{StaticResource AppName}" Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1" 
                        IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Top" Margin="0,45,30,0"/>
        </Grid>
        <GridView x:Name="itemGridView" 
                  ItemsSource="{Binding DownloadApps}"
                  Grid.Row="1"
                  IsItemClickEnabled="False"
                  SelectionMode="None"
                  Margin="120,0,0,0"
                  HorizontalAlignment="Left"
                  VerticalAlignment="Top"
                  Padding="0,0,0,40"
                  ItemContainerStyle="{StaticResource YourAppsPage_AppListItemStyle}"
                  >
            <GridView.ItemTemplate>
                <DataTemplate>
                    <Grid Width="311">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="10"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Border Grid.RowSpan="3" Grid.Column="0" Background="#92BCE7" Height="70" Width="70">
                            <Image Width="50" Height="50" Source="{Binding LogoUrl_Store,Converter={StaticResource IsShowDefaultPicConverter},ConverterParameter=/Images/default_50_50.png}"></Image>
                        </Border>
                        <TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding AppName}" Style="{StaticResource AppListPage_descriptionInfo2_TextStyle}"></TextBlock>
                        <ProgressBar Tag="正在下载" Grid.Row="1" Grid.Column="2" Width="210" Height="5" Value="{Binding AppProgressBarValue}" Minimum="0" Maximum="100" Background="White" Foreground="#85B5E4"></ProgressBar>
                        <TextBlock Grid.Row="2" Grid.Column="2" Text="{Binding AppDescription}" Style="{StaticResource AppListPage_descriptionInfo4_TextStyle}"></TextBlock>
                    </Grid>
                </DataTemplate>
            </GridView.ItemTemplate>
        </GridView>
        <TextBlock x:Name="txt_Tip" Grid.Row="1" Visibility="Collapsed" Margin="120,40,0,0" Foreground="#000000" FontSize="26" FontFamily="微软雅黑" Text="现在，没有正在安装的应用."></TextBlock>
    </Grid>
</Page>
